package com.bringspring.system.message.util;

import com.bringspring.common.util.RandomUtil;
import com.bringspring.system.message.entity.MessageEntity;
import com.bringspring.system.message.entity.MessageReceiveEntity;

import java.util.Date;

/**
 * 消息实体类
 *
 * @版本： V1.0.0
 * @版权： 股份有限公司
 * @作者： 开发平台组
 * @日期： 2021/4/22 9:06
 */
public class JsbosMessageUtil {
    public static MessageEntity setMessageEntity(String userId, String title, String bodyText, Integer recType) {
        MessageEntity entity = new MessageEntity();
        entity.setTitle(title);
        entity.setBodyText(bodyText);
        entity.setId(RandomUtil.uuId());
        entity.setType(recType+1);
        entity.setCreatorUserId(userId);
        entity.setCreatorTime(new Date());
        entity.setLastModifyTime(entity.getCreatorTime());
        entity.setLastModifyUserId(entity.getLastModifyUserId());
        return entity;
    }

    public static MessageReceiveEntity setMessageReceiveEntity(String messageId, String toUserId){
        MessageReceiveEntity entity = new MessageReceiveEntity();
        entity.setId(RandomUtil.uuId());
        entity.setMessageId(messageId);
        entity.setUserId(toUserId);
        entity.setIsRead(0);
        return entity;
    }
}
